#pragma once

#include <AVUITimeline.h>

namespace AVUI {

class MediaClock;
class Uri;
class MediaTimeline : public Timeline
{
public:
    DECLARE_ELEMENT(MediaTimeline, Timeline);

    DECLARE_DEPENDENCY_PROPERTY(Source);
    TRefCountedPtr<Uri> get_Source() { return (Uri*)(Object*)GetValue(get_SourceProperty()); }
    void set_Source(Uri* pValue) { SetValue(get_SourceProperty(), (Object*)pValue); } 

    TRefCountedPtr<MediaClock> CreateClock();
    virtual TRefCountedPtr<Clock> AllocateClock();

    MediaTimeline() { }

protected:

    virtual TRefCountedPtr<Freezable> CreateInstanceCore() AVUI_OVERRIDE { return object_allocate<MediaTimeline>().get_Ptr(); }

    // This should be a calculated length, when available. TODO -- Fix a lot of media handling.
    virtual Duration get_NaturalDurationCore(const Clock* pClock) { return (Duration) TimeSpan::FromMilliseconds(1000); }

private:
    static void StaticConstructor();

};


}; // namespace AVUI
